import { defineStore } from 'pinia'
import { ref, watch } from 'vue'

export const useToastStore = defineStore('toastStore', () => {
  const Toast = ref({
    trigger: false,
    errorMessage: '',
  })

  const setTrigger = (param) => {
    Toast.value.trigger = param
  }

  const setErrorMessage = (param) => {
    Toast.value.errorMessage = param
  }

  const set = (a, b) => {
    Toast.value.trigger = a
    Toast.value.errorMessage = b
  }

  return {
    setTrigger,
    setErrorMessage,
    set,
    Toast,
  }
})
